package com.guilin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.guilin.system.service.SurveyResponseDetailService;
import com.guilin.vo.SurveyResponseDetailVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.guilin.common.core.controller.BaseController;
import com.guilin.common.core.domain.AjaxResult;
import com.guilin.domain.SurveyResponseDetail;
import com.guilin.common.utils.poi.ExcelUtil;
import com.guilin.common.core.page.TableDataInfo;

/**
 * 问卷回答详情Controller
 * 
 * @author xiaoqi
 * @date 2025-06-24
 */
@RestController
@RequestMapping("/admin-management/detail")
public class SurveyResponseDetailController extends BaseController
{
    @Autowired
    private SurveyResponseDetailService surveyResponseDetailService;

    /**
     * 查询问卷回答详情列表
     */
    @PreAuthorize("@ss.hasPermi('admin-management:detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(SurveyResponseDetail surveyResponseDetail)
    {
        startPage();
        List<SurveyResponseDetailVO> list = surveyResponseDetailService.selectSurveyResponseDetailList(surveyResponseDetail);
        return getDataTable(list);
    }

    /**
     * 导出问卷回答详情列表
     */
    @PreAuthorize("@ss.hasPermi('admin-management:detail:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, SurveyResponseDetail surveyResponseDetail)
    {
        List<SurveyResponseDetailVO> list = surveyResponseDetailService.selectSurveyResponseDetailList(surveyResponseDetail);
        ExcelUtil<SurveyResponseDetailVO> util = new ExcelUtil<SurveyResponseDetailVO>(SurveyResponseDetailVO.class);
        util.exportExcel(response, list, "问卷回答详情数据");
    }

    /**
     * 获取问卷回答详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('admin-management:detail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(surveyResponseDetailService.selectSurveyResponseDetailById(id));
    }

}
